<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/9/11
  Time: 17:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common/include.jsp" %>
<html>
<head>
    <title>Title</title>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content  animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox ">
                <div class="ibox-content">

                    <div class="jqGrid_wrapper">
                        <div class="ui-jqgrid " id="gbox_table_list_2" dir="ltr">
                            <div class="ui-jqgrid-view table-responsive" role="grid" id="gview_table_list_2"
                            >


                                <form role="form" class="form-inline" style="margin-bottom: 10px" id="searchForm"
                                      method="post" action="checkDemandList.html">
                                    <input type="hidden" id="status" name="status" value="${status}">
                                    <input type="hidden" id="status1" name="status1" value="${status1}">
                                    <input type="hidden" id="userId" name="userId" value="true">
                                    <input type="hidden" id="pageName" name="pageName" value="${pageName}">
                                    <div class="form-group">


                                        <input type="text" name="conditions['createName']" placeholder="录入人"
                                               value="${pages.conditions.createName}"
                                               id="createName" class="form-control">&nbsp;&nbsp;&nbsp;
                                        <select id="demandProduct" name="conditions['demandProduct']"
                                                class="form-control"
                                                required="" aria-required="true">
                                            <option value="0"
                                                    <c:if test="${pages.conditions.demandProduct == 0}">selected</c:if>>
                                                问题产品
                                            </option>
                                            <c:forEach items="${productList}" var="product">
                                                <option
                                                        <c:if test="${pages.conditions.demandProduct == product.id}">selected</c:if>
                                                        value="${product.id}">${product.product_name}</option>
                                            </c:forEach>
                                        </select>

                                    </div>
                                    &nbsp;&nbsp;&nbsp;<button type="submit" class="btn btn-primary">搜索</button>
                                    &nbsp;&nbsp;&nbsp;<button type="button" id="resetBut" class="btn btn-reset">重置
                                </button>
                                </form>


                                <div class="ui-jqgrid-bdiv">
                                    <div style="position:relative;">
                                        <div></div>
                                        <table id="cusTable"
                                               class="ui-jqgrid-btable ui-common-table table table-bordered"
                                        >
                                            <tbody>
                                            <tr role="row" style="background: #F5F5F5;">
                                                <!--<td><input th:type="checkbox" name="ches"/>-->
                                                <td>编号
                                                </td>
                                                <td>标题
                                                </td>
                                                <td>描述</td>
                                                <td>反馈人
                                                </td>
                                                <td>所属产品

                                                </td>
                                                <td>录入人
                                                </td>
                                                <td style="width: 15%">录入时间
                                                </td>

                                                <td>
                                                    状态
                                                </td>
                                                <td>操作
                                                </td>
                                            </tr>


                                            <c:forEach items="${pages.pageDatas}" var="demand">
                                                <tr role="row" id="1" tabindex="-1"
                                                    class="jqgrow ui-row-ltr" demandId="${demand.id}"
                                                    statusText="${demand.status_text}">
                                                    <td>${demand.id}
                                                    </td>
                                                    <td>${demand.title}
                                                    </td>
                                                    <td>
                                                            ${fn:length(demand.detail) > 20 ? fn:substring(demand.detail,0,20) : demand.detail}

                                                    </td>
                                                    <td>
                                                            ${demand.feedback_name}
                                                    </td>
                                                    <td>
                                                            ${demand.demand_product_name}
                                                    </td>
                                                    <td>
                                                            ${demand.create_name}
                                                    </td>
                                                    <td>
                                                            ${demand.create_time}
                                                    </td>

                                                    <td>
                                                        <c:if test="${demand.is_reject == 2}">驳回中</c:if>
                                                        <c:if test="${demand.is_reject == 1}">${demand.status_text}</c:if>

                                                    </td>

                                                    <td>

                                                        <c:if test="${demand.is_reject == 1}">
                                                            <a btnType="exPlan" id="${demand.id}"
                                                               status="${demand.status}"
                                                               class="handleicon" type="button" title="分配"
                                                               isReceive="1"><i
                                                                    class="fa fa-check-circle"></i>
                                                            </a>

                                                            <a id="checkBtn" demId="${demand.id}"
                                                               status="${demand.status}"
                                                               title="驳回" class="handleicon" type="button"
                                                               isReceive="2"><i class="fa fa-undo"></i>
                                                            </a>

                                                            <a btnType="transfer" id="${demand.id}"
                                                               status="${demand.status}"
                                                               statusText="${demand.status_text}"
                                                               class="handleicon" type="button" title="转移"
                                                               demandType="2"><i
                                                                    class="fa fa-refresh"></i>
                                                            </a>
                                                        </c:if>
                                                    </td>
                                                </tr>

                                            </c:forEach>


                                            </tbody>
                                        </table>
                                        <c:if test="${pages.totalPages>1 }">
                                            <page:pager pageSize="${pages.pageSize}" currPage="${pages.currPage}"
                                                        totalRecords="${pages.totalRecords}"
                                                        url="${pageContext.request.contextPath}/checkDemandList.html?conditions['demandProduct']=${pages.conditions.demandProduct }&conditions['createName']=${pages.conditions.createName }&status=${status }&status1=${status1 }&pageName=${pageName }&userId=true"/>

                                        </c:if>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<!--弹框用-->

</body>

<script>


    $(function () {
        $("#resetBut").click(function () {
            $('#createName').val("");
            $('#demandProduct').val("0");
        })
    })


    var param = "";
    $(function () {




        //审核按钮
        $("[id=checkBtn]").click(function () {
            var isReceive = $(this).attr('isReceive');
            var title = "需求分配-驳回";
            //alert($(this).html());
            //alert($(this).attr('status'));
            //alert($(this).attr('demand_id'));
            //alert($(this).parent('tr').attr('custId'));
            index = layer.open({
                type: 2,
                title: title,
                skin: 'ilayui-layer-rm', //加上边框
                area: ['30%', '50%'], //宽高
                content: 'goRejectPage.html?id=' + $(this).attr('demId') + "&status=" + $(this).attr('status')
                + "&isReceive=" + isReceive
//                end: function () {
//                    location.reload();
//                }
            });
        });


        var index = 0;

        $("[btnType=exPlan]").click(function () {
            var isReceive = $(this).attr('isReceive');

            var title = "需求分配";


            //alert($(this).html());
            //alert($(this).attr('status'));
            //alert($(this).attr('demand_id'));
            //alert($(this).parent('tr').attr('custId'));
            index = layer.open({
                type: 2,
                title: title,
                skin: 'ilayui-layer-rm', //加上边框
                area: ['40%', '90%'], //宽高
                content: 'goExpPlan.html?id=' + $(this).attr('id') + "&status=" + $(this).attr('status')
                + "&isReceive=" + isReceive
//                end: function () {
//                    location.reload();
//                }
            });
        });


        //转移按钮
        $("[btnType=transfer]").click(function () {
            var statusText = $(this).attr('statusText');

            var title = "需求转移";


            //alert($(this).html());
            //alert($(this).attr('status'));
            //alert($(this).attr('demand_id'));
            //alert($(this).parent('tr').attr('custId'));
            index = layer.open({
                type: 2,
                title: title,
                skin: 'ilayui-layer-rm', //加上边框
                area: ['35%', '65%'], //宽高
                content: 'goTransferDepartmentPage.html?id=' + $(this).attr('id') + "&status=" + $(this).attr('status')
                + "&statusText=" + statusText,
//                end: function () {
//                    location.reload();
//                }
            });
        });


        //双击tr弹出页面
        $("#cusTable tr td").dblclick(function () {

            //alert($(this).html());
            //alert($(this).attr('custId'));
            //alert($(this).parent('tr').attr('custId'));
            var title = "需求-" + $(this).parent('tr').attr('statusText');
            index = layer.open({
                type: 2,
                title: title,
                skin: 'ilayui-layer-rm', //加上边框
                area: ['90%', '90%'], //宽高
                content: 'demandDetail.html?isCheck=true&demandId=' + $(this).parent('tr').attr('demandId'),
                end: function () {
                    location.reload();
                }
            });
        });
    });

</script>
</html>
